import { useState, useEffect } from 'react'

export default function App() {
  const [count, setCount] = useState(0)

  const handleClick = () => {
    setCount(count + 1)
    // !期望立即拿到更新之后的值
  }
  useEffect(() => {
    // 一上来会触发
    // count 变化之后会走这儿
    console.log(count)
  }, [count])

  return (
    <div>
      <h3>count: {count}</h3>
      <button onClick={handleClick}>count+1</button>
    </div>
  )
}
